<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="app"></div>

  <template id="my-app">
    <div :style="{color: 'red'}">哈哈哈</div>
    <div :style="{color: finalColor}">哈哈哈</div>

    <!-- 绑定一个data中的属性值，并且是一个对象 -->
    <div :class="finalStyleObj">哈哈哈</div>

    <!--  调用一个方法 -->
    <div :class="getfinalStyleObj()">哈哈哈</div>

  </template>

  <script src="../js/vue.js"></script>
  <script>
    const App = {
      template: "#my-app",
      data() {
        return {
          message: "Hello World",
          finalColor: "red"
        }
      },
      methods: {
        getfinalStyleObj() {
          return {
            'font-size': '50px',
            backgroundColor: "red",
            fonwWeight: 700,
          }
        }
      }
    };

    Vue.createApp(App).mount("#app");
  </script>
</body>

</html>